package com.yy.job.core.domain;

import java.util.Date;

import com.yy.job.common.dao.po.YYJobStepLogDO;
import com.yy.job.utils.ThrowableUtils;

public class JobStepExecLogDomain extends BaseDomain {
	
	private static final long serialVersionUID = -4118868300802208416L;
	
	private Long jobId;
	
	private Long jobStepId;
	
	private Long jobLogId;

	private Date execStartTime;
	
	private Date execEndTime;
	
	/**
	 * 执行结果
	 */
	private String jobStepResultFlag;
	
	/**
	 * 执行结果对象
	 */
	private String jobStepResult;

	private String errMsg;

	private String errStack;

	public Long getJobStepId() {
		return jobStepId;
	}

	public void setJobStepId(Long jobStepId) {
		this.jobStepId = jobStepId;
	}

	public String getErrMsg() {
		return this.errMsg;
	}

	public void setErrMsg(String errMsg) {
		this.errMsg = errMsg;
	}

	public String getErrStack() {
		return this.errStack;
	}

	public void setErrStack(String errStack) {
		this.errStack = errStack;
	}

	public Long getJobLogId() {
		return jobLogId;
	}

	public void setJobLogId(Long jobLogId) {
		this.jobLogId = jobLogId;
	}

	public Date getExecStartTime() {
		return execStartTime;
	}

	public void setExecStartTime(Date execStartTime) {
		this.execStartTime = execStartTime;
	}

	public Date getExecEndTime() {
		return execEndTime;
	}

	public void setExecEndTime(Date execEndTime) {
		this.execEndTime = execEndTime;
	}

	public YYJobStepLogDO convertToDO() {
		YYJobStepLogDO jobStepLogDO = new YYJobStepLogDO();
		jobStepLogDO.setId(this.getId());
		jobStepLogDO.setJobId(this.getJobId());
		jobStepLogDO.setJobLogId(this.getJobLogId());
		jobStepLogDO.setJobStepId(this.getJobStepId());
		jobStepLogDO.setExecStartTime(this.getExecStartTime());
		jobStepLogDO.setExecEndTime(this.getExecEndTime());
		jobStepLogDO.setJobStepResultFlag(this.getJobStepResultFlag());
		jobStepLogDO.setJobStepResult(this.getJobStepResult());
		jobStepLogDO.setErrMsg(ThrowableUtils.subStackTrace(this.getErrMsg(),500));
		//jobStepLogDO.setErrStack(this.getErrStack());
		jobStepLogDO.setErrStack(ThrowableUtils.subStackTrace(this.getErrStack()));
		
		jobStepLogDO.setGmtCreated(new Date());
		jobStepLogDO.setCreator(this.getOperator());
		jobStepLogDO.setGmtModified(new Date());
		jobStepLogDO.setModifier(this.getOperator());
		return jobStepLogDO;
	}

	public String getJobStepResultFlag() {
		return jobStepResultFlag;
	}

	public void setJobStepResultFlag(String jobStepResultFlag) {
		this.jobStepResultFlag = jobStepResultFlag;
	}

	public String getJobStepResult() {
		return jobStepResult;
	}

	public void setJobStepResult(String jobStepResult) {
		this.jobStepResult = jobStepResult;
	}

	public Long getJobId() {
		return jobId;
	}

	public void setJobId(Long jobId) {
		this.jobId = jobId;
	}

}
